// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   CMIScore.java

package com.iphaeton.lms.course.scorm12.datamodel.cmi;

import com.iphaeton.lms.course.scorm12.DebugIndicator;
import com.iphaeton.lms.course.scorm12.datamodel.Element;
import java.io.PrintStream;
import java.io.Serializable;

// Referenced classes of package com.iphaeton.lms.course.scorm12.datamodel.cmi:
//            CMICategory, CMIRequest, DMErrorManager

public class CMIScore extends CMICategory
    implements Serializable
{

    public CMIScore()
    {
        super(true);
        raw = new Element("", "checkScoreDecimal", "NULL", true, true, true);
        min = new Element("", "checkScoreDecimal", "NULL", true, true, true);
        max = new Element("", "checkScoreDecimal", "NULL", true, true, true);
    }

    public Element getRaw()
    {
        return raw;
    }

    public Element getMin()
    {
        return min;
    }

    public Element getMax()
    {
        return max;
    }

    public void setRaw(String inRaw)
    {
        raw.setValue(inRaw);
    }

    public void setMin(String inMin)
    {
        min.setValue(inMin);
    }

    public void setMax(String inMax)
    {
        max.setValue(inMax);
    }

    public boolean isInitialized()
    {
        boolean flag = false;
        if(raw.isInitialized() || min.isInitialized() || max.isInitialized())
            flag = true;
        return flag;
    }

    public boolean isValidRequest(CMIRequest theRequest)
    {
        boolean flag = false;
        String token = theRequest.getNextToken();
        if(token.equals("_children"))
            flag = true;
        else
        if(token.equals("raw") || token.equals("min") || token.equals("max"))
        {
            flag = true;
            if(theRequest.hasMoreTokensToProcess())
                if(theRequest.isAChildrenRequest())
                    flag = true;
                else
                    flag = false;
        }
        return flag;
    }

    public String performGet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        String result = new String("");
        String token = theRequest.getNextToken();
        if(theRequest.hasMoreTokensToProcess())
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + token + "is not a valid element of the CMI Score\n" + "Data Model Category");
            }
            if(theRequest.isAKeywordRequest())
                dmErrorMgr.recGetKeyWordError(theRequest.getElement());
            else
                dmErrorMgr.recNotImplementedError(theRequest);
        } else
        if(theRequest.isAChildrenRequest())
        {
            result = getChildren();
            dmErrorMgr.SetCurrentErrorCode("0");
        } else
        {
            result = determineElementValue(this, token, dmErrorMgr);
        }
        return result;
    }

    public String getChildren()
    {
        String children = "raw,min,max";
        return children;
    }

    public void performSet(CMIRequest theRequest, DMErrorManager dmErrorMgr)
    {
        String token = theRequest.getNextToken();
        if(theRequest.hasMoreTokensToProcess())
        {
            if(_Debug)
            {
                System.out.println("Error - Data Model Element not implemented");
                System.out.println("Element being processed: " + token + "is not a valid element of the CMI Score\n" + "Data Model Category");
            }
            dmErrorMgr.recNotImplementedError(theRequest);
        } else
        {
            String value = theRequest.getValue();
            if(!theRequest.isAKeywordRequest())
            {
                doSet(this, token, value, dmErrorMgr);
            } else
            {
                if(_Debug)
                {
                    System.out.println("Error - Cannot Set Data Model Element");
                    System.out.println("Element being processed: " + token + "cannot be set\n");
                }
                dmErrorMgr.recKeyWordError(token);
            }
        }
    }

    private static final long serialVersionUID = 0x9a0bc6df9a8a86d5L;
    private static boolean _Debug;
    public Element raw;
    public Element min;
    public Element max;

    static 
    {
        _Debug = DebugIndicator.ON;
    }
}
